package starter.data;

import java.util.ArrayList;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class LogoutTestCases {
	public void runTestCases(ArrayList<String> codeInjection,
			int codeInjectionSize) throws InterruptedException {
		ArrayList<String> webElements = new ArrayList<String>();
		webElements.add("email");
		webElements.add("password");
		logoutSuccesfull(webElements);
	}
	
	private void logoutSuccesfull(ArrayList<String> webElements) throws InterruptedException {
		WebDriver driver = new FirefoxDriver();
		driver.get("https://www.snapsation.com/login");
		WebElement email = driver.findElement(By.name(webElements.get(0)));
		email.sendKeys("damczechowski@gmail.com");
		WebElement password = driver.findElement(By.name(webElements.get(1)));
		password.sendKeys("admin123");
		email.submit();
		Thread.sleep(1800);
		driver.get("https://www.snapsation.com/settings/");
	    WebElement logoutLink = driver.findElement(By.id("settingsLogoutButton"));
	    logoutLink.click();
		Thread.sleep(1800);
	}
}